<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta content="webkit" name="renderer" />
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>

    <link rel="stylesheet" th:href="@{/src/css/layui.css}">
</head>
<body style="background-image: url('http://pic1.win4000.com/wallpaper/2018-01-15/5a5c745031e8b.jpg');opacity: 0.9;">
<form class="layui-form" action="" style="margin: auto;margin-top: 10%;background-color: #F8F8F8;width: 350px;height: 430px;border-radius: 5px;">
    <div style="background-color: #009f95;height:50px;line-height:50px;text-align: center;font-weight: 700;font-size: 20px;border-top-left-radius: 5px;border-top-right-radius: 5px">后台登录</div>
    <div class="layui-form-item" style="margin-top: 20px">
        <div class="layui-input-inline" style="margin-left: 38px;width: 280px;border-radius: 5px">
            <input type="text" name="account" required lay-verify="required" placeholder="请输入登录账户" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-inline" style="margin-left: 38px;width: 280px;border-radius: 5px">
            <input type="password" name="passWord" required lay-verify="required" placeholder="请输入登录密码" autocomplete="off" class="layui-input">
        </div>

    </div>
    <div class="layui-form-item" style="margin-left: 30px">
        <div class="layui-inline">
            <input type="checkbox" name="rememberMe" lay-skin="switch">
            <label class="layui-form-label">记住密码？</label>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block" style="margin: auto;text-align: center">
            <button class="layui-btn" lay-submit lay-filter="formDemo" style="width: 80%;border-radius: 5px">登录</button>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block" style="margin: auto;text-align: center">
            <a class="layui-btn layui-btn-warm" id="register" style="width: 80%;border-radius: 5px">点击注册</a>
        </div>
    </div>

</form>
<script src="/src/js/jquery-1.9.1.min.js"></script>
<script src="/src/layui.js"></script>
<script>
    //Demo
    layui.use(['form','jquery','layer','carousel'], function(){

        var form = layui.form ,$ = layui.jquery ,layer = layui.layer;

        $("#register").click(function () {
            layer.open({
                title:'管理员注册',
                type:2,
                area:['500px','700px'],
                content:'/login/register'
            });
        });
        //监听提交
        form.on('submit(formDemo)', function(data){
            $.ajax({
                url:'/loginOut',
                type:'post',
                data:data.field,
                dataType:'json',
                success:function (res) {
                    if (res.code == 200){
                        layer.msg(res.message,{icon:1},function () {
                            if(top.location!=self.location){//判断当前页面当前是否存在父页面
                                window.parent.location.reload();
                            }else {//跳转到管理系统首页
                                location.href = "/system/index";
                            }
                        });
                    }else {
                        layer.msg(res.message,{icon:5});
                    }
                }
            })
            return false;
        });
    });
</script>
</body>
</html>